package net.hn.hnms.biz.plan.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.hn.hnms.biz.plan.domain.PlanWashing;
import net.hn.hnms.biz.plan.vo.PlanWashingVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface PlanWashingMapper extends BaseMapper<PlanWashing> {



    @Select("<script>" +
            "  select case when count(washing_plan_id)>0 then count(washing_plan_id)   else null end  as totalPlan, " +
            "  sum(washing_plan_amount) as totalWashingPlanAmount, " +
            "  min(washing_plan_start_date) as washingPlanStartDate, " +
            "  max(washing_plan_end_date) as washingPlanEndDate " +
            "  from plan_washing where del_flag ='0' and  mine_code =#{mineCode} " +
            "</script>")
    PlanWashingVO selectWashingTotalByMineCode(@Param("mineCode") String mineCode);


    @Select("<script>" +
            "  select case when count(washing_plan_id)>0 then count(washing_plan_id)   else null end  as totalPlan, " +
            "  sum(washing_plan_amount) as totalWashingPlanAmount, " +
            "  min(washing_plan_start_date) as washingPlanStartDate, " +
            "  max(washing_plan_end_date) as washingPlanEndDate " +
            "  from plan_washing where del_flag ='0' and  company_code =#{mineCode} " +
            "</script>")
    PlanWashingVO selectDrivageTotalByCompanyCodeOrName(@Param("mineCode") String mineCode);
}
